define(['jquery',
        'underscore',
        'handlebar',
        'backbone',
        'helpers/spinJS',
        'views/VHeader',
        'views/Vcarousel',
        'views/VFooter',
        'views/category/VCategory',
        'views/product/VProducts',
        'views/sellerInfo/VsellerInfo',
        'views/detailsProductInfo/VdetailsProductInfo',
        'views/filters/VFilters'
        ],
function($,
         Underscore,
         Handlebar,
         Backbone,
         SpinJS,
         VHeader,
         Vcarousel,
         VFooter,
         VCategory,
         VProducts,
         VsellerInfo,
         VdetailsProductInfo,
         VFilters
         ){

    var spinner ="";
    window.AppView = Backbone.View.extend({
       
        initialize:function (){            
            spinner = new SpinJS();
                    
        },
        initialPageLoad: function () {
           
            //show spin  and pass parent id to append the spinner
            spinner.showSpin('bodyPart');

            var vHeader = new VHeader();
            var vCategory = new VCategory();
            
            var vcarousel = new Vcarousel();
            vcarousel.loadCarousel();

            var vsellerInfo = new VsellerInfo();
            vsellerInfo.loadSellerInfo();


            var vFooter = new VFooter();
            vFooter.loadFooter();

            //hide spin
            spinner.hideSpin();
                                                 
        },
        setPageView: function () {

            this.showLeftPanel();
            this.showFilter();

             var vHeader = new VHeader();
             var vCategory = new VCategory();
             var vFooter = new VFooter();
             vFooter.loadFooter();
        },
        showLeftPanel: function () {
           

            $('#leftPanel').removeClass('hide').addClass('show');
            $('#productCntr').removeClass('col-sm-12').addClass('col-sm-9');

            
       },
        hideLeftPanel: function () {
           $('#leftPanel').removeClass('show').addClass('hide');
           $('#productCntr').removeClass('col-sm-9').addClass('col-sm-12');

       },
       loadHeaderAndSearhBox:function(){
           //load header
           var vHeader = new VHeader();
           //load serch bo
           var vCategory = new VCategory();
       },
       loadFooter:function(){
           var vFooter = new VFooter();
           vFooter.loadFooter();
       },
       showProductDetailedView: function (prodId) {

           //loadHeader and search box
           this.loadHeaderAndSearhBox();

           //load product detail view
           var vdetailsProductInfo = new VdetailsProductInfo();
           vdetailsProductInfo.fetchDetailedProductInfo(prodId);

           //loadHeader and search box
           this.loadFooter();
       },
       showFilter: function () {
           var vFilters = new VFilters();
       }
    });
    return AppView;
});